var url = '';
function getUrl() {
	$.ajax({
		type : 'GET',
		url : 'http://blog.karstock.net/uploadurl.do?redirect=0',
		async : false,
		success : function(data) {
			url = data;
		},
	});
}
$(function() {
	getUrl();
	$('#upload_file').uploadify({
		'swf' : contextPath + '/js/uploadify.swf',
		'uploader' : url,
		'method' : 'post',
		'fileSizeLimit' : '10MB',
		'fileTypeExts' : "*.gif,*;*.jpg;*.png",
		'cancelImg' : 'images/uploadify-cancel.png',
		'buttonText' : '上传图片',
		'onUploadSuccess' : function(file, data, response) {
			$('#img').attr("src", data);
			getUrl();
			$('#upload_file').uploadify('settings', 'uploader', url);
		}
	});
});